import classNames from 'classnames'

export const DISPLAY_NAME_OPTION = 'Option'

export interface SelectOptionProps {
  index?: string
  /** 默认根据此属性值进行筛选，该值不能相同*/
  value: string
  /** 选项的标签，若不设置则默认与 value 相同*/
  label?: string
  /** 是否禁用该选项*/
  disabled?: boolean
}

// 获取组件配置的class
export const getOptionClassNames = (
  props: SelectOptionProps,
  extendClass?: () => Object
) => {
  const { disabled } = props
  return classNames(
    'select-item',
    {
      'is-disabled': disabled,
    },
    extendClass && extendClass()
  )
}
